package com.syp.hehe.util.dbrouter.datasource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

import com.syp.hehe.util.dbrouter.DBContextHolder;

public class DynamicDataSource extends AbstractRoutingDataSource {
	
    private static final Logger logger	= LoggerFactory.getLogger(DynamicDataSource.class.toString());

    @Override
    protected Object determineCurrentLookupKey() {
        logger.info("current db key:{}", DBContextHolder.getDbKey());
    	return DBContextHolder.getDbKey();//获取当前数据源
    }

}
